home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2899 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  45 lines

  1. Newsgroups: comp.lang.c
  2. Path: news.Stanford.EDU!microunity!toms
  3. From: toms@MicroUnity.com (Tom Sanders)
  4. Subject: Re: Floating point calculation order
  5. Message-ID: <DLpF0C.IH4@microunity.com>
  6. Sender: usenet@microunity.com (news id)
  7. Organization: MicroUnity Systems Engineering, Inc.
  8. References: <m0tedv8-0002eqC@sice.nsk.su> <3104c6d9.134061184@nntp.ix.netcom.com> <TANMOY.96Jan23144637@qcd.lanl.gov>
  9. Date: Wed, 24 Jan 1996 21:14:36 GMT
  10.  
  11. In article <TANMOY.96Jan23144637@qcd.lanl.gov>, tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) writes:
  12. |> --text follows this line--
  13.  
  14. |> possibilities. 
  15. |> 
  16. |> There is absolutely no ambiguity in `p * q / r', and no parentheses
  17. |> are necessary.
  18. |> 
  19. |>    gave a warning if I did have an equation that could be evaluated in more
  20. |>    than 1 order (something I have not done in over 20 years).
  21. |> 
  22. |> I am almost certain you write `a + b * c' contrary to your claim. Do
  23. |> you mean `a + (b * c)' or `(a + b) * c' when, if, you do it? If you do
  24. |> not, you are in a very small minority.
  25. |> 
  26. |> Cheers
  27. |> Tanmoy
  28. |> --
  29. |> tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: 
  30.  
  31. Sorry Tanmoy you'd be wrong, I do write `a + (b * c)' not `a + b * c' .
  32. Do I need to , no of course not.  I prefer to for clarity.  If I specify
  33. exactly what I want when I write it, there is little doubt in the future
  34. if I or someone else is debugging a problem.  If I leave the parentheses
  35. out, I or someone else may wonder whether it was intended to be 
  36. `(a + b) * c' and waste time in a useless direction.
  37.  
  38. As to the original equation `p * q / r' , I would argue that parentheses
  39. are certainly necessary.  There is a slight numeric difference between
  40. `(p * q) / r' and `p * (q / r)' .  By specifying I am sure the order I
  41. prefer will be used no matter what compiler I am using.
  42.  
  43. Tom Sanders
  44.  
  45.